package com.learn.security.core.validate.code.image;

import com.learn.security.core.validate.code.ValidateCode;

import java.awt.image.BufferedImage;
import java.time.LocalDateTime;

/**
 * 图形验证码
 */
public class ImageCode extends ValidateCode {

    private static final long serialVersionUID = 667276930451460770L;

    private BufferedImage image;

    /**
     * 验证码构造器
     * @param image BufferedImage对象，作用主要将图片加载到内存
     * @param code 验证码字符
     * @param expireIn 验证码生效的截止时间
     */
    public ImageCode(BufferedImage image, String code, int expireIn) {
        super(code,expireIn);
        this.image = image;
    }

    /**
     * 验证码构造器
     * @param image BufferedImage对象，作用主要将图片加载到内存
     * @param code 验证码字符
     * @param expireTime 验证码的有效时间（以秒为单位）
     */
    public ImageCode(BufferedImage image, String code, LocalDateTime expireTime) {
        super(code,expireTime);
        this.image = image;
    }

    public BufferedImage getImage() {
        return image;
    }

    public void setImage(BufferedImage image) {
        this.image = image;
    }
}
